/*
 * Package: org.grassfield.common.dao
 * FileName: UserRoleDAO.java
 *  
 * Created by pandian on Jan 28, 2011
 */
package dao;

import java.util.List;

import bean.UserRole;



/**
 * The Class UserRole.
 */
public class UserRoleDAO extends BaseDAO implements IUserRoleDAO {

	@Override
	public UserRole add(UserRole userRole) {
		return (UserRole) super.save(userRole);
	}

	@Override
	public UserRole find(Long id) {
		String qry = "from UserRole u where u.id=?";
		List<Object> list = super.list(qry, new Object[]{id});
		if (!list.isEmpty()){
			return (UserRole) list.get(0);
		}
		return null;
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<UserRole> list() {
		String qry = "from UserRole u order by name";
		return super.list(qry);
	}

}
